﻿using AiXiu.BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using AiXiu.Model;
using System.Drawing;

namespace AiXiu.WebSite
{
    public partial class UserList1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            TBUsersBLL db = new TBUsersBLL();
            var list = db.getList();
            GvUserList.DataSource = list;
            GvUserList.DataBind();
        }

        protected void GvUserList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            var user = e.Row.DataItem as TBUsers;
            if (user!=null)
            {
                if (user.Sex==0)
                {
                    e.Row.BackColor = Color.Red;
                    e.Row.ForeColor = Color.White;
                }
                if (user.Sex == 1)
                {
                    e.Row.Cells[2].Text = "男";
                }
                else if (user.Sex == 2)
                {
                    e.Row.Cells[2].Text = "女";
                }
                else {
                    e.Row.Cells[2].Text = "未知";
                }
            }
        }
    }
}